package com.ala4.oxcafe.properties;

import com.ala4.oxcafe.constants.CoreConstants;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 文件配置
 *
 * @author PING
 * @date 2024/2/2 21:15
 */
@Data
@Component
@ConfigurationProperties(prefix = CoreConstants.SYSTEM_NAME + ".static-file")
public class FileProperties {

    /**
     * 静态资源对外暴露的访问路径
     */
    private String staticAccessPath = "/upload/**";

    /**
     * 文件上传目录
     */
    private String uploadFolder = "./file/";

    /**
     * 外网host
     */
    private String host;

    public String getStaticHostPath() {
        return host + staticAccessPath.replace("**", "");
    }

}
